#include "ScnsKeyboardGpio.c.h"

#if defined(SCNS_KEYBOARD_GPIO_ENABLE)&&SCNS_KEYBOARD_GPIO_ENABLE==1

#include "ScnsKey.h"
#include "ScnsLed.h"
#include "ScnsMath.h"
#include "stm32f103xe.h"

const ScnsKeyEnum scnsBspKeyboardGpioKeyEnum[SCNS_BSP_KEYBOARD_GPIO_KEY_MAX]={
    SCNS_KEY_0,
    SCNS_KEY_1,
    SCNS_KEY_UP,
};

ScnsKeyPress scnsBspKeyboardGpioGet(uint8 keyN)
{
    if(keyN==0) return (((KEY0_GPIO_Port->IDR&KEY0_Pin))?SCNS_KEY_PRESS_UP:SCNS_KEY_PRESS_DOWN);
    if(keyN==1) return (((KEY1_GPIO_Port->IDR&KEY1_Pin))?SCNS_KEY_PRESS_UP:SCNS_KEY_PRESS_DOWN);
    if(keyN==2) return (((KEY_UP_GPIO_Port->IDR&KEY_UP_Pin))?SCNS_KEY_PRESS_DOWN:SCNS_KEY_PRESS_UP);
    return SCNS_KEY_PRESS_UP;
}

#endif
